﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StructureMap;

namespace SharpTrack.Application.Web {

    public class StructureMapControllerFactory : DefaultControllerFactory {
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType) {
            try {
                return (IController)ObjectFactory.GetInstance(controllerType);
            }
            catch (StructureMapException) {
                System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave());
                throw;
            }
        }
    }
}
